<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>

var digui = function (num) {
    if( num == 1 ){
        return 1
    }
    return num * digui(num-1)
}

var num = 5
console.log(digui(num))
    </script>
</body>
</html>